package cn.demomaster.quickdb.sql;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import java.util.List;


public abstract class SqlCreator {

    public SQLiteOpenHelper sqLiteHelper;

    public SqlCreator(SQLiteOpenHelper sqLiteHelper) {
        this.sqLiteHelper = sqLiteHelper;
    }

    public SQLiteDatabase getDb() {
        return sqLiteHelper.getReadableDatabase();
    }

    public abstract <T> boolean insert(T model);
    public abstract <T> boolean insertArray(List<T> models, Class<T> clazz);
    public abstract <T> boolean delete(T model);
    public abstract boolean delete(String tableName, ContentValues contentValues);
    public abstract <T> boolean deleteAll(String tableName);
    public abstract <T> boolean deleteAll(Class<T> clazz);
    public abstract <T> T modify(T model);
    public abstract <T>  boolean modifyArray(List<T> models);
    public abstract <T> T findOne(T model);
    public abstract <T> T findOne(String sql, Class<T> clazz);
    public abstract <T> List<T> findArray(T model);
    public abstract <T> List<T> findArray(String sql, Class<T> clazz);
}
